package com.qf.mytoubuju;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.zip.Inflater;

public class MainActivity extends AppCompatActivity {

    private ListView listView;
    private MyAdapter adapter;
    private ArrayList<Data1> list;

//    private ImageView tou_iv,jiao_iv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initVeiw();
    }

    private void initVeiw() {
        listView= (ListView) findViewById(R.id.lv);
        View touView= LayoutInflater.from(this).inflate(R.layout.tou,null);
//        tou_iv= (ImageView) findViewById(R.id.tou_iv);
        listView.addHeaderView(touView);
        View jiaoView= LayoutInflater.from(this).inflate(R.layout.jiao,null);
//        jiao_iv= (ImageView) findViewById(R.id.jiao_iv);
        listView.addFooterView(jiaoView);
        list=new ArrayList<>();
        adapter=new MyAdapter(this,list);
        listView.setAdapter(adapter);
        loadDAta();
    }

    private void loadDAta() {
        Data1 da=new Data1();
        for (int i = 0; i < 20; i++) {
            da.name=i+"哈哈哈";
            list.add(da);
        }
        adapter.notifyDataSetChanged();
    }
}
